<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="__STATIC__/js/jquery.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/bootstrap-table/js/bootstrap-table.js"></script>
    <script src="__STATIC__/bootstrap-table/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="__STATIC__/bootstrap-table/js/dropdown.js"></script>
    <link rel="stylesheet" href="__STATIC__/bootstrap-table/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="__STATIC__/bootstrap-table/css/bootstrap.css">
    <script type="text/javascript" src="__STATIC__/x-admin/js/xadmin.js"></script>
    <link rel="stylesheet" href="__STATIC__/x-admin/css/font.css">
    <link rel="stylesheet" href="__STATIC__/x-admin/css/xadmin.css">
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="#">设备管理</a>
        <a href="#">步数信息</a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="layui-row">
    <form class="layui-form layui-col-md12 x-so" onsubmit="return false">
        <input class="layui-input" placeholder="开始日" autocomplete="off" name="start" id="start">
        <input class="layui-input" placeholder="截止日" autocomplete="off" name="end" id="end">
        <input type="text" name="username"  placeholder="设备编号" autocomplete="off" class="layui-input">
        <button class="layui-btn"  id="search"><i class="layui-icon">&#xe615;</i></button>
    </form>
</div>
<table id="heart_rate" style="white-space: nowrap">

</table>
</body>
<script>
    layui.use(['laydate','layer'], function(){
        var laydate = layui.laydate;
        layer = layui.layer;
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });
</script>
<script>
    $('#heart_rate').bootstrapTable({
        //获取行号
        language: 'zh-CN',
        todayHighlight: true,
        striped: true,//设置为 true 会有隔行变色效果
        method: 'post',//服务器数据的请求方式 'get' or 'post'
        url: "{:url('/heart_rate/getHeartRateInfo')}",//服务器数据的加载地址
        toolbar:'#toolbar',//
        searchOnEnterKey:true,
        sortName:'ID',//排序字段
        sortOrder : 'desc',//降序
        sidePagination: "server",   //分页方式：client客户端分页，server服务端分页（*）
        pagination: 'false',//设置为 true 会在表格底部显示分页条
        clickToSelect:'true',//设置true 将在点击行时，自动选择rediobox 和 checkbox
        singleSelect:'true',//设置True 将禁止多选
        pageSize: '15',//如果设置了分页，页面数据条数
        pageList:[15,30,50],
        smartDisplay:false,
        //得到查询的参数
        queryParams : function (params) {
            //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var temp = {
                rows: params.limit,                         //页面大小
                page: (params.offset / params.limit) + 1,   //页码
                sort: params.sort,      //排序列名
                sortOrder: params.order,//排位命令（desc，asc）
                searchName:$("input[name=username]").val(),
                start:$("#start").val(),
                end:$("#end").val()
            };
            return temp;
        },
        columns: [
            //                {title:'请选择',align:'center',checkbox : true},
            {field: 'id', title: 'ID', align:'center'},
            {field: 'number', title: '设备编号', align:'center'},
            {field: 'seq_num', title: '指令流水号', align:'center'},
            {field: 'sub_type', title: '指令类型', align:'center'},
            {field: 'longitude', title: '经度', align:'center'},
            {field: 'latitude', title: '纬度', align:'center'},
            {field: 'gps_speed', title: 'GPS速度', align:'center'},
            {field: 'gps_direction', title: 'GPS方向', align:'center'},
            {field: 'satellite_number', title: '卫星数', align:'center'},
            {field: 'lbs', title: 'LBS数据', align:'center'},
            {field: 'electric_quantity', title: '电量', align:'center'},
            {field: 'gsm', title: 'GSM信号', align:'center'},
            {field: 'heart_rate', title: '心率', align:'center'},
            {field: 'timestamp', title: '指令时间', align:'center'},
            {field: 'create_time', title: '创建时间', align:'center'}
        ]
    });
    $("#search").click(function(){
        $("#heart_rate").bootstrapTable(('refresh'));
    });
</script>
</html>